<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * 关于我们
 * Class Base
 * @author heyu
 */
class AboutUs extends MY_Controller {
    /**
     * @var AdmSettingModel
     */
    public $mSetting = null;

    /**
     * 初始化
     * User constructor.
     */
    public function __construct() {
        parent::__construct();
        $this->loadModel('AdmSettingModel', 'mSetting');
    }

    /**
     * 首页
     */
    public function index(){
        $aboutUs = $this->mSetting->getExplain('about_us');
        $data = array(
            'aboutUs' => $aboutUs,
            'title' => '关于我们'
        );
        $this->view('config/aboutUs', $data, 'validation,ueditor');
    }

    /**
     * 保存数据
     */
    public function save(){
        $data = array(
            'about_us' => trim(post('content')),
        );
        if($this->mSetting->update($this->mSetting->tbExplain, $data)){
            $this->ajaxReturn(1, '保存成功', null, getUrl('config/aboutUs'));
        }
        $this->ajaxReturn(0, '保存失败');
    }

}
